<template>
  <div
    :class="[posterImageStatus ? 'noscroll product-con' : 'product-con']"
    ref="box"
    @scroll.native="onScroll"
    v-show="showAll"
  >
    <!-- <div
      class="header acea-row row-center-wrapper"
      :style="'opacity:' + opacity"
      ref="header"
    >
      <div
        class="item"
        :class="navActive === index ? 'on' : ''"
        v-for="(item, index) in navList"
        :key="index"
        @click="asideTap(index)"
      >
        {{ item }}
      </div>
    </div> -->
    <div id="title0">
      <product-con-swiper
        v-if="is_seckill == 0"
        :img-urls="storeInfo.slider_image"
        :videoline="storeInfo.video_link"
      ></product-con-swiper>
      <product-con-swiper
        v-if="is_seckill == 1"
        :img-urls="seckill.images"
        :videoline="storeInfo.video_link"
      ></product-con-swiper>
      <div class="active_label" v-show="storeInfo.is_free == 1">
        <div class="free_buy">
          <p class="left">
            限时<span
              style="font-size:.8rem;font-style:italic;margin-right:.1rem;font-weight:600;"
              >0</span
            >元购
          </p>
          <p class="right">
            <span class="stock">库存剩余</span>
            <span class="num">
              <!-- <font>5</font>
              <font>0</font>
              <font>0</font> -->
              <font
                v-for="(item, index) in String(attr.productSelect.stock)"
                :key="index"
                >{{ item }}</font
              >
              <!-- <font>0</font> -->
              <span>件</span>
            </span>
          </p>
        </div>
      </div>
      <div class="active_label1" v-show="is_seckill == 1">
        <div class="free_buy">
          <p class="left">
            <span style="font-size:.3rem;font-weight:600;">￥</span
            >{{ seckill.price }}
          </p>
          <div class="right">
            <p class="likeTitle">距结束：</p>
            <p class="time">
              <span>{{ seckill.h }}</span> : <span>{{ seckill.m }}</span> :
              <span>{{ seckill.s }}</span>
            </p>
          </div>
        </div>
      </div>
      <div class="wrapper">
        <div class="share acea-row row-between row-bottom">
          <div class="money font-color-red">
            <div v-if="storeInfo.is_free == 0 && is_seckill == 0">
              ￥<span style="font-size:0.56rem;">{{
                attr.productSelect.price.split(".")[0]
              }}</span
              >.{{ attr.productSelect.price.split(".")[1] }}
              <span
                v-if="attr.productSelect.ot_price > attr.productSelect.price"
                class="old_price"
                style="font-size:.4rem;color:rgba(192,192,192,1);text-decoration: line-through;font-weight:400;"
                >￥{{ attr.productSelect.ot_price }}</span
              >
            </div>
            <div
              v-else-if="storeInfo.is_free == 0 && is_seckill == 1"
              class="old_price"
              style="font-size:.4rem;color:rgba(192,192,192,1);text-decoration: line-through;font-weight:400;"
            >
              ￥{{ seckill.ot_price }}
            </div>
            <div
              v-else
              class="old_price"
              style="font-size:.4rem;color:rgba(192,192,192,1);text-decoration: line-through;font-weight:400;"
            >
              ￥{{ attr.productSelect.price }}
            </div>

            <div class="item" @click="setCollect">
              <div class="iconfont">
                <img
                  src="@assets/images/icon-onlike.png"
                  alt=""
                  srcset=""
                  v-show="!storeInfo.userCollect"
                />
                <img
                  src="@assets/images/iconshoucang.png"
                  alt=""
                  srcset=""
                  v-show="storeInfo.userCollect"
                />
              </div>
              <div
                v-show="storeInfo.userCollect"
                style="color:rgba(15, 15, 15, 0.2);"
              >
                已收藏
              </div>
              <div v-show="!storeInfo.userCollect">收藏</div>
              <div class="showDiv" v-show="showDiv" @click.stop="collection">
                <img src="@assets/images/toHeart.png" alt="" />
              </div>
            </div>
          </div>
          <p class="title-detail" v-if="is_seckill == '0'">
            {{ storeInfo.store_name }}
          </p>
          <p class="title-detail" v-if="is_seckill == '1'">
            {{ seckill.title }}
          </p>
          <!-- <div
            class="iconfont icon-fenxiang"
            @click="listenerActionSheet"
          ></div> -->
        </div>
        <!-- ----------- -->
        <!-- <div class="introduce">{{ storeInfo.store_name }}</div>
        <div class="label acea-row row-between-wrapper">
          <div>原价:￥{{ storeInfo.ot_price }}</div>
          <div>库存:{{ storeInfo.stock }}{{ storeInfo.unit_name }}</div>
          <div>销量:{{ storeInfo.fsales }}{{ storeInfo.unit_name }}</div>
        </div> -->
        <!-- <div
          class="coupon acea-row row-between-wrapper"
          @click="couponTap"
          v-if="couponList.length"
        >
          <div class="hide line1 acea-row">
            优惠券：
            <div
              class="activity"
              v-for="(item, index) in couponList"
              :key="index"
            >
              满{{ item.use_min_price }}减{{ item.coupon_price }}
            </div>
          </div>
          <div class="iconfont icon-jiantou"></div>
        </div>
        <div class="coupon acea-row row-between-wrapper" v-if="activity.length">
          <div class="line1 acea-row">
            活&nbsp;&nbsp;&nbsp;动：
            <div
              v-for="(item, index) in activity"
              :key="index"
              @click="goDetail(item)"
            >
              <div
                class="acea-row row-center-wrapper"
                v-if="item.type === '1'"
                :class="{
                  activity_pin: index === 0,
                  activity_miao: index === 1,
                  activity_kan: index === 2
                }"
              >
                <span class="iconfonts iconfont icon-shenhezhong"></span>
                <span class="activity_title">&nbsp;参与秒杀</span>
              </div>
              <div
                class="acea-row row-center-wrapper"
                v-if="item.type === '2'"
                :class="{
                  activity_pin: index === 0,
                  activity_miao: index === 1,
                  activity_kan: index === 2
                }"
              >
                <span class="iconfonts iconfont icon-kanjia"></span>
                <span class="activity_title">&nbsp;参与砍价</span>
              </div>
              <div
                class="acea-row row-center-wrapper"
                v-if="item.type === '3'"
                :class="{
                  activity_pin: index === 0,
                  activity_miao: index === 1,
                  activity_kan: index === 2
                }"
              >
                <span class="iconfonts iconfont icon-pintuan"></span>
                <span class="activity_title">&nbsp;参与拼团</span>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div
        class="attribute acea-row row-between-wrapper"
        @click="selecAttrTap"
        v-if="attr.productAttr.length"
      >
        <div>
          {{ attrTxt }}：<span class="atterTxt">{{ attrValue }}</span>
        </div>
        <div class="iconfont icon-jiantou"></div> -->
        <!-- ------------ -->
      </div>
      <div class="first_order" v-show="storeInfo.is_first_order_reduce == 1">
        <div class="item">
          <div class="item_left">
            <p>
              <span>新人专享折扣</span>
              <img
                @click="showbox"
                src="../../assets/images/active_help.png"
                alt=""
              />
            </p>
            <p>9月21号到12月31号首单立享95折</p>
          </div>
          <div class="item_right">首单立减</div>
        </div>
      </div>
      <!-- 优惠劵模块 -->
      <div
        class="coupon acea-row row-between-wrapper"
        @click="couponTap"
        v-if="couponList.length"
      >
        <div class="hide  acea-row">
          优惠
          <div
            class="activity"
            v-for="(item, index) in couponList"
            :key="index"
          >
            满{{ item.use_min_price }}减{{ item.coupon_price }}
          </div>
        </div>
        <div class="more">
          <span class="text">领劵</span>
          <span class="iconfont icon-jiantou"></span>
        </div>
      </div>
      <div class="choice-type" v-if="storeInfo.is_virtual == 0">
        <span class="choice-title">服务</span>
        <span v-show="storeInfo.is_seven_returned == 1" class="choice-content"
          >7天无理由退货</span
        >
        <span v-show="storeInfo.is_seven_returned == 0" class="choice-content"
          >不支持7天无理由退货</span
        >
        <img
          src="@assets/images/ask.png"
          alt=""
          class="showReturnGoods"
          @click.stop="isShowreturn(storeInfo.is_seven_returned)"
        />
        <img
          src="@assets/images/returnGoods.png"
          alt=""
          class="returnGoods"
          v-show="showreturn"
        />
        <img
          src="@assets/images/returnGoods0.png"
          alt=""
          class="returnGoods0"
          v-show="showreturn0"
        />
      </div>
      <div class="choice-type">
        <span class="choice-title">库存</span>
        <!-- <span class="choice-content"
          >{{ attr.productSelect.stock }}{{ storeInfo.unit_name }}</span
        > -->
        <span
          class="choice-content"
          v-if="
            attr.productSelect.stock >= 100 && attr.productSelect.stock <= 1000
          "
        >
          {{ attr.productSelect.stock }} {{ attr.storeInfo.unit_name }}
        </span>
        <span
          class="choice-content"
          style="color:rgba(252, 64, 74, 1);"
          v-if="attr.productSelect.stock < 100"
        >
          剩余{{ attr.productSelect.stock }}
          {{ attr.storeInfo.unit_name }} 库存紧张
        </span>
        <span class="choice-content" v-if="attr.productSelect.stock > 1000">
          库存充足
        </span>
        <span class="rightnum" v-if="is_seckill == 0"
          >{{ storeInfo.sales + storeInfo.ficti }}
          {{ storeInfo.unit_name }}</span
        >
        <span class="rightnum" v-if="is_seckill == 1"
          >{{ seckill.sales + storeInfo.ficti }} {{ seckill.unit_name }}</span
        >
        <span class="righttitle">已售</span>
      </div>
      <div class="choice-type">
        <span class="choice-title">已选</span>
        <span class="choice-content">{{ attrValue }} </span>
        <!-- {{ attr.productSelect.cart_num
          }}{{ storeInfo.unit_name }} -->
        <img
          src="@assets/images/block_card.png"
          alt=""
          class="right_show"
          @click="selecAttrTap"
        />
      </div>
      <div class="choice-type" v-if="storeInfo.is_virtual == 0">
        <span class="choice-title">配送</span>
        <span class="choice-content">普通快递</span>
      </div>
      <div class="choice-type exchange" v-if="storeInfo.is_virtual == 1">
        <span class="choice-title exchange-title">兑换流程</span>
        <span class="exchange-content" v-html="storeInfo.exchange_dec"></span>
      </div>
      <div class="goodDetail-title">
        <span class="img"></span>
        <span class="span">商品详情</span>
        <span class="img"></span>
      </div>
      <div class="product-intro" id="title3">
        <div class="conter" v-html="storeInfo.description"></div>
      </div>

      <!--<div-->
      <!--class="store-info"-->
      <!--v-if="system_store.id !== undefined && storeSelfMention"-->
      <!--&gt;-->
      <!--<div-->
      <!--class="acea-row row-between-wrapper store-box"-->
      <!--@click="showStoreList"-->
      <!--&gt;-->
      <!--<div class="title">门店信息</div>-->
      <!--<div class="iconfont icon-jiantou"></div>-->
      <!--</div>-->
      <!--<div class="info acea-row row-between-wrapper">-->
      <!--<div class="pictrue"><img :src="storeItems.image" /></div>-->
      <!--<div class="text">-->
      <!--<div class="name line1">-->
      <!--{{ storeItems.name }}-->
      <!--</div>-->
      <!--<div class="address acea-row row-middle" @click="showChang">-->
      <!--<span class="addressTxt line1 address_tit"-->
      <!--&gt;{{ storeItems.address-->
      <!--}}{{ ", " + storeItems.detailed_address }}</span-->
      <!--&gt;<span class="iconfont icon-youjian"></span>-->
      <!--</div>-->
      <!--</div>-->
      <!--<div class="addressBox">-->
      <!--<a-->
      <!--class="iconfont icon-dadianhua01 font-color-red phone"-->
      <!--:href="'tel:' + storeItems.phone"-->
      <!--&gt;</a>-->
      <!--<div-->
      <!--class="addressTxt corlor-red"-->
      <!--@click="showChang"-->
      <!--v-if="storeItems.range"-->
      <!--&gt;-->
      <!--距离{{ storeItems.range }}千米-->
      <!--</div>-->
      <!--</div>-->
      <!--</div>-->
      <!--</div>-->
    </div>
    <!-- <div class="userEvaluation" id="title1">
      <div class="title acea-row row-between-wrapper">
        <div>用户评价({{ replyCount }})</div>
        <router-link :to="{ path: '/evaluate_list/' + id }" class="praise"
          ><span class="font-color-red">{{ replyChance }}%</span>好评率<span
            class="iconfont icon-jiantou"
          ></span
        ></router-link>
      </div>
      <user-evaluation :reply="reply"></user-evaluation>
    </div>
    <div class="superior" v-if="goodList.length > 0" id="title2">
      <div class="title acea-row row-center-wrapper">
        <img src="@assets/images/ling.png" />
        <div class="titleTxt">优品推荐</div>
        <img src="@assets/images/ling.png" />
      </div>
      <template>
        <div class="slider-banner banner">
          <swiper :options="swiperRecommend">
            <swiper-slide v-for="(item, index) in goodList" :key="index">
              <div class="list acea-row row-middle">
                <div
                  class="item"
                  v-for="val in item.list"
                  :key="val.image"
                  @click="goGoods(val)"
                >
                  <div class="pictrue">
                    <img :src="val.image" />
                    <span
                      class="pictrue_log pictrue_log_class"
                      v-if="val.activity && val.activity.type === '1'"
                      >秒杀</span
                    >
                    <span
                      class="pictrue_log pictrue_log_class"
                      v-if="val.activity && val.activity.type === '2'"
                      >砍价</span
                    >
                    <span
                      class="pictrue_log pictrue_log_class"
                      v-if="val.activity && val.activity.type === '3'"
                      >拼团</span
                    >
                  </div>
                  <div class="name line1">{{ val.store_name }}</div>
                  <div class="money font-color-red">¥{{ val.price }}</div>
                </div>
              </div>
            </swiper-slide>
            <div class="swiper-pagination" slot="pagination"></div>
          </swiper>
        </div>
      </template>
    </div>
    <div class="product-intro" id="title3">
      <div class="title">产品介绍</div>
      <div class="conter" v-html="storeInfo.description"></div>
    </div> -->
    <div style="height:1.2rem;"></div>
    <div class="footer acea-row row-between-wrapper" v-show="!hideBottom">
      <div class="item" @click="backGoodsShop">
        <div class="iconfont">
          <img src="@assets/images/icon-shop.png" alt="" srcset="" />
        </div>
        <div>店铺</div>
      </div>

      <div
        class="item"
        v-if="this.service_tel == null || this.service_tel.length == 0"
      >
        <div class="iconfont" @click="telTip">
          <img src="@assets/images/icon-kefu.png" alt="" srcset="" />
        </div>
        <div>客服</div>
      </div>
      <div class="item" v-else>
        <a :href="'tel:' + service_tel">
          <div class="iconfont">
            <img src="@assets/images/icon-kefu.png" alt="" srcset="" />
          </div>
          <div>客服</div>
        </a>
      </div>
      <!-- <div class="item" @click="setCollect">
        <div class="iconfont">
          <img
            src="@assets/images/icon-onlike.png"
            alt=""
            srcset=""
            v-show="!storeInfo.userCollect"
          />
          <img
            src="@assets/images/iconshoucang.png"
            alt=""
            srcset=""
            v-show="storeInfo.userCollect"
          />
        </div>
        <div>收藏</div>
      </div> -->
      <div class="item" style="" @click="toCart()">
        <div style="margin-left:0.1rem;" class="iconfont">
          <img src="@assets/images/cart.png" alt="" srcset="" />
        </div>
        <div style="width:0.6rem;">购物车</div>
      </div>
      <!-- <router-link
       
        class="item animated"
        :class="animated === true ? 'bounceIn' : ''"
      >
        <div class="iconfont icon-gouwuche1">
          <span class="num bg-color-red" v-if="CartCount > 0">{{
            CartCount
          }}</span>
        </div>
        <div style="width:0.8rem;">购物车</div>
      </router-link> -->
      <div class="bnt acea-row">
        <div
          class="joinCart"
          @click="joinCart"
          v-show="attr.productSelect.stock > 0"
        >
          加入购物车
        </div>
        <div class="buy" @click="tapBuy" v-show="attr.productSelect.stock > 0">
          立即购买
        </div>
        <div class="noshop" v-show="attr.productSelect.stock == 0">
          当前无货
        </div>
      </div>
    </div>
    <Share-red-packets
      :priceName="priceName"
      v-on:changeFun="changeFun"
      v-if="priceName !== 0"
    ></Share-red-packets>
    <CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>
    <Product-window
      v-on:changeFun="changeFun"
      :attr="attr"
      :is_limit_buy="is_limit_buy"
    ></Product-window>
    <!-- <StorePoster
      v-on:setPosterImageStatus="setPosterImageStatus"
      :posterImageStatus="posterImageStatus"
      :posterData="posterData"
    ></StorePoster> -->
    <ShareInfo
      v-on:setShareInfoStatus="setShareInfoStatus"
      :shareInfoStatus="shareInfoStatus"
    ></ShareInfo>
    <div
      class="generate-posters acea-row row-middle"
      :class="posters ? 'on' : ''"
    >
      <div
        class="item"
        v-if="weixinStatus === true"
        @click="setShareInfoStatus"
      >
        <div class="iconfont icon-weixin3"></div>
        <div class="">发送给朋友</div>
      </div>
      <!-- <div class="item" @click="setPosterImageStatus">
        <div class="iconfont icon-haibao"></div>
        <div class="">生成海报</div>
      </div> -->
    </div>
    <div
      class="mask"
      @touchmove.prevent
      @click="listenerActionClose"
      v-show="posters"
    ></div>
    <div class="geoPage" v-if="mapShow">
      <iframe
        width="100%"
        height="100%"
        frameborder="0"
        scrolling="no"
        :src="
          'https://apis.map.qq.com/uri/v1/geocoder?coord=' +
            system_store.latitude +
            ',' +
            system_store.longitude +
            '&referer=' +
            mapKey
        "
      >
      </iframe>
    </div>
    <!-- 二次确认弹窗 -->
    <div class="confirmBox" v-show="isConfirm">
      <div class="ceng">
        <p class="confirmTltle">是否确定取消收藏</p>
        <div>
          <span class="NoConfirm" @click="NoConfirm()">取消</span>
          <span class="confirm" @click="confirm()">确定</span>
        </div>
      </div>
    </div>
    <!-- 首单立减说明 -->
    <div class=" mask1" v-show="posters1">
      <!-- <transition name='first_order'> -->
      <div class="content" ref="mask1">
        <div class="top">活动说明</div>
        <div class="center">
          <p>1.活动仅限新用户尊享，新用户首次下单立享95折优惠</p>
          <p>
            2.活动不与0元购，限时秒杀等促销活动叠加使用（具体促销活动请以商品详情页展示为准）
          </p>
          <p>
            3.若新用户首次享95折购买后产生退换货行为，则再次购买也不再享受新人95折专享优惠。
          </p>
        </div>
        <div class="bottom" @click.stop="closeBox">我知道了</div>
      </div>
      <!-- </transition> -->
    </div>
  </div>
</template>
<script>
import { swiper, swiperSlide } from "vue-awesome-swiper";
import "@assets/css/swiper.min.css";
import ProductConSwiper from "@components/ProductConSwiper";
import UserEvaluation from "@components/UserEvaluation";
// import ShareRedPackets from "@components/ShareRedPackets";
import shareMsg from "../../assets/js/common/shareConfig.js";
import share from "../../assets/js/common/share.js";
import CouponPop from "@components/CouponPop";
import ProductWindow from "@components/ProductWindow";
// import cookie from "@utils/store/cookie";
import { clearAuthStatus } from "@libs/wechat";
import dayjs from "dayjs";
import StorePoster from "@components/StorePoster";
import ShareInfo from "@components/ShareInfo";
import { goShopDetail } from "@libs/order";
import debounce from "lodash.debounce";
import {
  getCartList,
  getProductDetail,
  postCartAdd,
  getCartCount,
  getProductCode,
  storeListApi
} from "@api/store";
import {
  getCoupon,
  getCollectAdd,
  getCollectDel,
  getUserInfo
} from "@api/user";
import { isWeixin } from "@utils/index";
import { wechatEvevt } from "@libs/wechat";
import { imageBase64 } from "@api/public";
import { mapGetters } from "vuex";
import cookie from "@utils/store/cookie";
import base from "@common/base";
import { setTimeout } from "timers";
// import { setInterval, clearTimeout } from "timers";
let NAME = "GoodsCon";
const LONGITUDE = "user_longitude";
const LATITUDE = "user_latitude";
export default {
  name: NAME,
  components: {
    swiper,
    swiperSlide,
    ProductConSwiper,
    UserEvaluation,
    // ShareRedPackets,
    CouponPop,
    ProductWindow,
    StorePoster,
    ShareInfo
  },
  data: function() {
    return {
      showAll: false,
      shareInfoStatus: false,
      weixinStatus: false,
      mapShow: false,
      mapKey: "",
      posterData: {
        image: "",
        title: "",
        price: "",
        code: ""
      },
      posterImageStatus: false,
      animated: false,
      coupon: {
        coupon: false,
        list: []
      },
      attr: {
        cartAttr: false,
        productAttr: [],
        productSelect: {},
        storeInfo: {}
      },
      is_limit_buy: "",
      isOpen: false, //是否打开属性组件
      productValue: [],
      id: 0,
      storeInfo: {},
      couponList: [],
      attrTxt: "请选择",
      attrValue: "",
      cart_num: 1, //购买数量
      replyCount: "",
      replyChance: "",
      reply: [],
      priceName: 0,
      CartCount: 0,
      posters: false,
      banner: [{}, {}],
      swiperRecommend: {
        pagination: {
          el: ".swiper-pagination",
          clickable: true
        },
        autoplay: false,
        loop: false,
        speed: 1000,
        observer: true,
        observeParents: true
      },
      goodList: [],
      system_store: {},
      storeSelfMention: true,
      storeItems: {},
      activity: [],
      navList: [],
      lock: false,
      navActive: 0,
      opacity: 0,
      showreturn: false, //服务图标展示与否
      showreturn0: false,
      showDiv: false,
      mer_id: "",
      timer: "",
      isConfirm: false,
      from1: "",
      from2: "",
      service_tel: "",
      where: {
        mer_id: ""
      },
      posters1: false,
      hideBottom: false,
      is_seckill: "",
      seckill: "",
      countTimetimer: ""
    };
  },
  computed: mapGetters(["isLogin"]),
  watch: {
    $route(n) {
      if (n.name === NAME) {
        this.id = n.params.id;
        this.storeInfo.slider_image = [];
        this.productCon();
      }
    }
  },

  mounted: function() {
    document.title = "商品详情";
    localStorage.cutUrl='';
    if (this.$route.query.isToken) {
      this.$store.commit(
        "LOGIN",
        this.$route.query.isToken
        // dayjs(expires_time) - newTime
      );
      cookie.set("OID", this.$route.query.oId);
    }
    if (this.$route.query.ishideBottom == "1") {
      this.hideBottom = true;
    }
    document.scrollingElement.scrollTop = 0;
    let isFromApp = this.$route.query.from1;
    var that = this;
    this.double();
    this.from2 = isFromApp;
    this.from1 = cookie.get("from1");
    if (this.$route.query.mer_id) {
      cookie.set("mer_id", this.$route.query.mer_id);
    }
    this.where.mer_id = this.$route.query.mer_id;
    if (this.from1 == "app" || isFromApp == "app") {
      cookie.set("from1", "app");
      this.getTitle();
      this.getParameter();
      // this.isNo();
      window["onWebResponse"] = str => {
        that.onWebResponse(str);
      };
    } else if (this.from1 == "wxapp" || isFromApp == "wxapp") {
      cookie.set("from1", "wxapp");
    } else {
      cookie.set("loginType", "0");
      cookie.set("from1", "h5");
    }
    document.addEventListener("scroll", this.onScroll, false);
    this.id = this.$route.params.id;
    if (isWeixin()) {
      cookie.set("detailId", this.$route.params.id);
    } else {
      if (this.from1 != "app" && this.$route.query.from1 != "app") {
        window.location.href = 'http://share.cbct.cn/downloadPage'
      }
    }
    this.storeInfo.slider_image = [];
    setTimeout(function() {
      that.productCon();
    }, 100);
    this.coupons();
    window.addEventListener("scroll", this.handleScroll);
    // this.getList();
  },
  methods: {
    //显示首单立减说明
    showbox() {
      this.posters1 = true;
      // setTimeout(()=>{
      //   this.$refs.mask1.style.transform = 'translateY(0%)';
      // },500)
    },
    //关闭首单立减说明
    closeBox() {
      this.posters1 = false;
    },
    toCart: function() {
      if (this.animated == true) {
        return;
      } else {
        if (this.isLogin) {
          if (this.from1 == "app" || this.$route.query.from1 == "app") {
            this.$router.push({ path: "/cart?from1=app" });
          } else if (
            this.from1 == "wxapp" ||
            this.$route.query.from1 == "wxapp"
          ) {
            this.$router.push({ path: "/cart?from1=wxapp" });
          } else {
            this.$router.push({ path: "/cart" });
          }
        } else {
          this.getCartList();
        }
      }
    },
    getCartList: function() {
      let that = this;
      getCartList().then(res => {
        that.cartList = res.data;
        this.ishave = true;
        let checkedIds = [];
        that.$set(that.cartList.valid, "checked", false);
        if (!Array.isArray(checkedIds)) checkedIds = [];
        this.cartList.valid.forEach(cart => {
          if (checkedIds.length) {
            if (checkedIds.indexOf(cart.id) !== -1) cart.checked = true;
            else cart.checked = false;
          }
        });
        if (checkedIds.length) {
          that.checkedIds = checkedIds;
        }
        // that.isAllSelect =
        //   that.checkedIds.length === this.cartList.valid.length;
        that.carnum();
        that.countMoney();
        this.loaded = true;
      });
    },
    // 嵌入app获取支付状态
    onWebResponse: function(str) {
      var obj = JSON.parse(str);
      // alert(obj.action);
      var action = obj.action;
      var self = this;
      var content = obj.content;
      if (action == "setUserInfo") {
        let did = content.did;
        let isToken = content.ds_token;
        let expires_time = content.ds_expires_time;
        let isSalt = content.salt;
        if (isToken == "") {
          this.$store.commit(
            "LOGIN",
            isToken
            // dayjs(expires_time) - newTime
          );
        } else {
          // alert(isToken);
          let newTime = Math.round(new Date() / 1000);
          this.$store.commit(
            "LOGIN",
            isToken
            // dayjs(expires_time) - newTime
          );
        }
      }
    },
    getParameter: function() {
      var self = this;
      var u = navigator.userAgent,
        app = navigator.appVersion;
      var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1; //g
      var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
      const win = window;
      var obj = {
        action: "getParameter",
        content: {
          method: "setUserInfo",
          Parameter: {}
        }
      };
      if (isAndroid) {
        App.onAppResponse(JSON.stringify(obj));
      }
      if (isIOS) {
        win.webkit.messageHandlers.onAppResponse.postMessage(
          JSON.stringify(obj)
        );
      }
    },
    //声音禁掉
    isNo: function() {
      var u = navigator.userAgent,
        app = navigator.appVersion;
      var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1; //g
      var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
      const win = window;
      var obj = {
        action: "onClickPlay",
        content: {}
      };
      if (isAndroid) {
        App.onAppResponse(JSON.stringify(obj));
      }
      if (isIOS) {
        win.webkit.messageHandlers.onAppResponse.postMessage(
          JSON.stringify(obj)
        );
      }
    },
    // 收藏
    collection: function() {
      // this.$router.push({ path: "/collection" });
      if (this.from1 == "app" || this.from2 == "app") {
        this.$router.push({ path: "/collection?from1=app" });
      } else if (this.from1 == "wxapp" || this.from2 == "wxapp") {
        this.$router.push({ path: "/collection?from1=wxapp" });
      } else {
        this.$router.push({ path: "/collection" });
      }
    },
    backGoodsShop: function() {
      if (this.from1 == "app" || this.from2 == "app") {
        this.$router.push({
          path: "/goods_list/" + this.mer_id + "?from1=app"
        });
      } else if (this.from1 == "wxapp" || this.from2 == "wxapp") {
        this.$router.push({
          path: "/goods_list/" + this.mer_id + "?from1=wxapp"
        });
      } else {
        this.$router.push({ path: "/goods_list/" + this.mer_id });
      }
    },
    isShowreturn: function(num) {
      var that = this;
      if (num == 1) {
        this.showreturn = !this.showreturn;
        if (this.showreturn) {
          var timer1 = setTimeout(() => {
            that.showreturn = false;
            clearTimeout(timer1);
          }, 2000);
        }
      }
      if (num == 0) {
        this.showreturn0 = !this.showreturn0;
        if (this.showreturn0) {
          var timer0 = setTimeout(() => {
            that.showreturn0 = false;
            clearTimeout(timer0);
          }, 2000);
        }
      }
    },
    // 商品详情跳转
    goDetail(item) {
      if (item.type === "1") {
        this.$router.push({
          path: "/activity/seckill_detail/" + item.id + "/" + item.time + "/1"
        });
      } else if (item.type === "2") {
        this.$router.push({
          path: "/activity/dargain_detail/" + item.id
        });
      } else {
        this.$router.push({
          path: "/activity/group_detail/" + item.id
        });
      }
    },
    // 获取门店列表数据
    getList() {
      let data = {
        latitude: cookie.get(LATITUDE) || "", //纬度
        longitude: cookie.get(LONGITUDE) || "", //经度
        page: 1,
        limit: 10
      };
      storeListApi(data)
        .then(res => {
          this.storeItems = res.data.list[0];
        })
        .catch(err => {
          console.log(err);
        });
    },
    handleScroll() {
      let top = document.body.scrollTop || document.documentElement.scrollTop;
      let opacity = top / 350;
      opacity = opacity > 1 ? 1 : opacity;
      this.opacity = opacity;
    },
    asideTap(a) {
      this.$nextTick(() => {
        let index = a;
        this.navActive = index;
        if (!this.goodList.length && index === 2) {
          index = 3;
        }
        let element = document.querySelector("#title" + index);
        // const top =
        //   element.offsetTop - this.$refs.header.offsetHeight - window.scrollY;
        // this.lock = true;
        // window.scrollBy({ top, left: 0, behavior: "smooth" });
      });
    },
    onScroll: debounce(function() {
      if (this.lock) {
        this.lock = false;
        return;
      }
      const headerHeight = ({ scrollY } = window),
        titles = [];
      titles.push(document.querySelector("#title0"));
      titles.push(document.querySelector("#title1"));
      if (this.goodList.length) {
        titles.push(document.querySelector("#title2"));
      }
      titles.push(document.querySelector("#title3"));
      titles.reduce((initial, title, index) => {
        if (
          !document.querySelector("#title0") &&
          !document.querySelector("#title1") &&
          !document.querySelector("#title2")
        ) {
          return;
        }
        if (initial) return initial;
        // if (scrollY + headerHeight < title.offsetTop + title.offsetHeight) {
        //   initial = true;
        //   this.navActive = index;
        // }
        return initial;
      }, false);
    }, 500),
    showChang: function() {
      if (isWeixin()) {
        let config = {
          latitude: parseFloat(this.storeItems.latitude),
          longitude: parseFloat(this.storeItems.longitude),
          name: this.storeItems.name,
          address: this.storeItems.address + this.system_store.detailed_address
        };
        wechatEvevt("openLocation", config)
          .then(res => {
            console.log(res);
          })
          .catch(res => {
            if (res.is_ready) {
              res.wx.openLocation(config);
            }
          });
      } else {
        if (!this.mapKey)
          return this.$dialog.error(
            "暂无法使用查看地图，请配置您的腾讯地图key"
          );
        this.mapShow = true;
      }
    },
    // updateTitle() {
    //   document.title = this.storeInfo.store_name;
    //   this.getTitle();
    // },
    getTitle: function() {
      var self = this;
      var u = navigator.userAgent,
        app = navigator.appVersion;
      var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1; //g
      var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
      var obj = {
        action: "setTitle",
        content: {
          title: "商品详情"
        }
      };
      if (isAndroid) {
        App.onAppResponse(JSON.stringify(obj));
      }
    },
    // 调转到门店列表
    showStoreList() {
      this.$store.commit("GET_TO", "details");
      this.$router.push("/shop/storeList/details");
    },
    setOpenShare: function() {
      var data = this.storeInfo;
      var href = location.href;
      if (isWeixin()) {
        if (this.isLogin) {
          getUserInfo().then(res => {
            href =
              href.indexOf("?") === -1
                ? href + "?spread=" + res.data.uid
                : href + "&spread=" + res.data.uid;
            var configAppMessage = {
              desc: data.store_info,
              title: data.store_name,
              link: href,
              imgUrl: data.image
            };
            wechatEvevt(
              ["updateAppMessageShareData", "updateTimelineShareData"],
              configAppMessage
            )
              .then(res => {
                console.log(res);
              })
              .catch(res => {
                if (res.is_ready) {
                  res.wx.updateAppMessageShareData(configAppMessage);
                  res.wx.updateTimelineShareData(configAppMessage);
                }
              });
          });
        } else {
          var configAppMessage = {
            desc: data.store_info,
            title: data.store_name,
            link: href,
            imgUrl: data.image
          };
          wechatEvevt(
            ["updateAppMessageShareData", "updateTimelineShareData"],
            configAppMessage
          )
            .then(res => {
              console.log(res);
            })
            .catch(res => {
              if (res.is_ready) {
                res.wx.updateAppMessageShareData(configAppMessage);
                res.wx.updateTimelineShareData(configAppMessage);
              }
            });
        }
      }
    },
    setShareInfoStatus: function() {
      this.shareInfoStatus = !this.shareInfoStatus;
      this.posters = false;
    },
    shareCode: function(value) {
      var that = this;
      // getProductCode(that.id).then(res => {
      //   if (res.data.code) that.posterData.code = res.data.code;
      //   value === false && that.listenerActionSheet();
      // });
    },
    // setPosterImageStatus: function() {
    //   var sTop = document.body || document.documentElement;
    //   sTop.scrollTop = 0;
    //   this.posterImageStatus = !this.posterImageStatus;
    //   this.posters = false;
    // },
    //产品详情接口；
    productCon: function() {
      let that = this;
      getProductDetail(that.id, that.where)
        .then(res => {
          this.showAll = true;
          // cookie.set('title1','res.data.storeInfo.store_name')
          if (that.from1 == "app" || that.$route.query.from1 == "app") {
            var shareUrl = window.location.href;
            if (shareUrl.indexOf("from1=app") != "-1") {
              shareUrl = shareUrl.split("from1=app").join("from1=h5");
            }
            if (shareUrl.indexOf("detail") != "-1") {
              shareMsg.shareConfig(
                "app",
                "0",
                "0",
                res.data.storeInfo.store_name,
                res.data.merchant_name,
                shareUrl,
                res.data.storeInfo.image,
                "",
                "1"
              );
            }
          }
          that.is_seckill = res.data.is_seckill;
          that.is_limit_buy = res.data.is_limit_buy;
          if (res.data.is_seckill == "1") {
            that.seckill = res.data.seckill;
            if (that.countTimetimer != "") {
              clearInterval(that.countTimetimer);
            }
            that.countTimetimer = setInterval(function() {
              if (that.is_seckill == "1") {
                var timeDom = "";
                var date = new Date();
                var now = parseInt(date.getTime() / 1000);
                var differTime = that.seckill.stop_time - now;
                // console.log(now);
                var h, m, s;
                if (differTime > 0) {
                  h = Math.floor(differTime / 60 / 60);
                  m = Math.floor((differTime / 60) % 60);
                  s = Math.floor(differTime % 60);
                  h = h < 10 ? "0" + h : h;
                  m = m < 10 ? "0" + m : m;
                  s = s < 10 ? "0" + s : s;
                  timeDom = h + ":" + m + ":" + s;
                } else {
                  clearInterval(that.countTimetimer);
                  that.is_seckill = "0";
                }
                that.$set(that.seckill, "h", h);
                that.$set(that.seckill, "m", m);
                that.$set(that.seckill, "s", s);
              }
            }, 1000);
          }
          that.$set(that, "storeInfo", res.data.storeInfo);
          that.$set(that.attr, "productAttr", res.data.productAttr);
          that.$set(that.attr, "storeInfo", res.data.storeInfo);
          that.$set(that, "productValue", res.data.productValue);
          that.$set(that, "mer_id", res.data.mer_id);
          that.$set(that, "replyCount", res.data.replyCount);
          that.$set(that, "replyChance", res.data.replyChance);
          console.log(1234);
          that.reply = res.data.reply ? [res.data.reply] : [];
          that.$set(that, "reply", that.reply);
          that.$set(that, "priceName", res.data.priceName);
          // that.$set(that.storeInfo,'detailname',res.data.productValue);
          that.posterData.image = that.storeInfo.image_base;
          that.activity = res.data.activity ? res.data.activity : [];
          console.log(12345);
          if (that.storeInfo.store_name.length > 30) {
            that.posterData.title =
              that.storeInfo.store_name.substring(0, 30) + "...";
          } else {
            that.posterData.title = that.storeInfo.store_name;
          }
          console.log(123456);
          that.storeSelfMention = res.data.store_self_mention ? true : false;
          that.posterData.price = that.storeInfo.price;
          that.posterData.code = that.storeInfo.code_base;
          that.system_store = res.data.system_store;
          // let good_list = res.data.good_list || [];
          this.service_tel = res.data.service_tel;
          // let goodArray = [];
          // let count = Math.ceil(good_list.length / 6);
          // for (let i = 0; i < count; i++) {
          //   var list = good_list.slice(i * 6, i * 6 + 6);
          //   if (list.length) goodArray.push({ list: list });
          // }
          // that.mapKey = res.data.mapKey;
          // that.$set(that, "goodList", goodArray);
          // let navList = ["商品", "评价", "详情"];
          // if (goodArray.length) {
          //   navList.splice(2, 0, "推荐");
          // }
          // that.navList = navList;
          // that.updateTitle();
          that.DefaultSelect();
          // that.getCartCount();
          // that.getImageBase64();
          // that.setOpenShare();
          if (
            that.from1 != "app" &&
            that.from2 != "app" &&
            that.from1 != "wxapp" &&
            that.from2 != "wxapp"
          ) {
            var shareUrl1 = window.location.href;
            share.share(
              shareUrl1,
              res.data.storeInfo.store_name,
              res.data.merchant_name,
              res.data.storeInfo.image
            );
            share.QQshare(
              shareUrl1,
              res.data.storeInfo.store_name,
              res.data.merchant_name,
              res.data.storeInfo.image
            );
          }
        })
        .catch(res => {
          console.log(res);
          this.$dialog.error(res.msg);
          // this.$router.go(-1);
        });
    },
    getImageBase64: function() {
      let that = this;
      imageBase64(this.posterData.image, that.posterData.code)
        .then(res => {
          that.posterData.image = res.data.image;
          that.posterData.code = res.data.code;
          that.isLogin && that.shareCode();
        })
        .catch(() => {
          that.isLogin && that.shareCode();
        });
    },
    //默认选中属性；
    DefaultSelect: function() {
      let productAttr = this.attr.productAttr,
        value = [];
      for (var key in this.productValue) {
        if (this.productValue[key].stock > 0) {
          value = this.attr.productAttr.length ? key.split(",") : [];
          break;
        }
      }
      for (let i = 0; i < productAttr.length; i++) {
        this.$set(productAttr[i], "index", value[i]);
      }
      //sort();排序函数:数字-英文-汉字；
      let productSelect = this.productValue[value.sort().join(",")];
      console.log(value.sort().join(","));
      if (productSelect && productAttr.length) {
        this.$set(
          this.attr.productSelect,
          "store_name",
          this.storeInfo.store_name
        );
        this.$set(this.attr.productSelect, "image", productSelect.image);
        this.$set(this.attr.productSelect, "price", productSelect.price);
        this.$set(this.attr.productSelect, "ot_price", productSelect.ot_price);
        this.$set(this.attr.productSelect, "stock", productSelect.stock);
        this.$set(this.attr.productSelect, "unique", productSelect.unique);
        this.$set(this.attr.productSelect, "cart_num", 1);
        this.$set(this, "attrValue", value.sort().join(","));
        this.$set(this, "attrTxt", "已选择");
      } else if (!productSelect && productAttr.length) {
        this.$set(
          this.attr.productSelect,
          "store_name",
          this.storeInfo.store_name
        );
        this.$set(this.attr.productSelect, "image", this.storeInfo.image);
        this.$set(this.attr.productSelect, "price", this.storeInfo.price);
        this.$set(this.attr.productSelect, "stock", 0);
        this.$set(this.attr.productSelect, "unique", "");
        this.$set(this.attr.productSelect, "cart_num", 0);
        this.$set(this, "attrValue", "");
        this.$set(this, "attrTxt", "请选择");
      } else if (!productSelect && !productAttr.length) {
        this.$set(
          this.attr.productSelect,
          "store_name",
          this.storeInfo.store_name
        );
        this.$set(this.attr.productSelect, "image", this.storeInfo.image);
        this.$set(this.attr.productSelect, "price", this.storeInfo.price);
        this.$set(this.attr.productSelect, "stock", this.storeInfo.stock);
        this.$set(
          this.attr.productSelect,
          "unique",
          this.storeInfo.unique || ""
        );
        this.$set(this.attr.productSelect, "cart_num", 1);
        this.$set(this, "attrValue", "");
        this.$set(this, "attrTxt", "请选择");
        console.log(this.attrValue);
      }
      console.log(this.attr.productSelect);
    },
    //购物车；
    ChangeCartNum: function(changeValue) {
      //changeValue:是否 加|减
      //获取当前变动属性
      let productSelect = this.productValue[this.attrValue];
      //如果没有属性,赋值给商品默认库存
      if (productSelect === undefined && !this.attr.productAttr.length)
        productSelect = this.attr.productSelect;
      //无属性值即库存为0；不存在加减；
      if (productSelect === undefined) return;
      let stock = productSelect.stock || 0;
      let num = this.attr.productSelect;
      if (changeValue) {
        num.cart_num++;
        if (num.cart_num > stock) {
          this.$set(this.attr.productSelect, "cart_num", stock);
          this.$set(this, "cart_num", stock);
        }
      } else {
        num.cart_num--;
        if (num.cart_num < 1) {
          this.$set(this.attr.productSelect, "cart_num", 1);
          this.$set(this, "cart_num", 1);
        }
      }
    },
    //将父级向子集多次传送的函数合二为一；
    changeFun: function(opt) {
      if (typeof opt !== "object") opt = {};
      let action = opt.action || "";
      let value = opt.value === undefined ? "" : opt.value;
      this[action] && this[action](value);
    },
    //打开优惠券插件；
    couponTap: function() {
      let that = this;
      that.coupons();
      that.coupon.coupon = true;
    },
    changecoupon: function(msg) {
      this.coupon.coupon = msg;
      this.coupons();
    },
    currentcoupon: function(res) {
      let that = this;
      that.coupon.coupon = false;
      that.$set(that.coupon.list[res], "is_use", true);
    },
    //可领取优惠券接口；
    coupons: function() {
      let that = this,
        q = { page: 0, mer_id: this.$route.query.mer_id, product_id: that.id };
      getCoupon(q).then(res => {
        that.$set(that, "couponList", (res.data.length && [res.data[0]]) || []);
        that.$set(
          that.coupon,
          "list",
          res.data.map(item => ({ ...item, showInfo: false }))
        );
      });
    },
    //打开属性插件；
    selecAttrTap: function() {
      this.attr.cartAttr = true;
      this.isOpen = true;
    },
    changeattr: function(msg) {
      this.attr.cartAttr = msg;
      this.isOpen = false;
    },
    //选择属性；
    ChangeAttr: function(res) {
      let productSelect = this.productValue[res];
      if (productSelect) {
        this.$set(this.attr.productSelect, "image", productSelect.image);
        this.$set(this.attr.productSelect, "price", productSelect.price);
        this.$set(this.attr.productSelect, "stock", productSelect.stock);
        this.$set(this.attr.productSelect, "unique", productSelect.unique);
        this.$set(this.attr.productSelect, "cart_num", 1);
        this.$set(this, "attrValue", res);
        this.$set(this, "attrTxt", "已选择");
      } else {
        this.$set(this.attr.productSelect, "image", this.storeInfo.image);
        this.$set(this.attr.productSelect, "price", this.storeInfo.price);
        this.$set(this.attr.productSelect, "stock", 0);
        this.$set(this.attr.productSelect, "unique", "");
        this.$set(this.attr.productSelect, "cart_num", 0);
        this.$set(this, "attrValue", "");
        this.$set(this, "attrTxt", "请选择");
      }
    },
    NoConfirm() {
      this.isConfirm = false;
      document.getElementsByClassName("router")[0].style.position = "static";
    },
    confirm() {
      var that = this;
      var id = that.storeInfo.id;
      var category = "product";
      that.showDiv = false;
      getCollectDel(id, category).then(function() {
        that.storeInfo.userCollect = !that.storeInfo.userCollect;
        that.isConfirm = false;
        document.getElementsByClassName("router")[0].style.position = "static";
      });
    },

    //收藏商品
    setCollect: function() {
      let that = this,
        id = that.storeInfo.id,
        mer_id = this.where.mer_id;
      if (that.is_seckill == "0") {
        var category = "product";
      } else if (that.is_seckill == "1") {
        var category = "product_seckill";
      }
      if (that.storeInfo.userCollect) {
        that.isConfirm = true;
        //  document.getElementsByClassName('router')[0].style.position='fixed';
        //  document.getElementsByClassName('router')[0].style.top='0px';
        //  document.getElementsByClassName('router')[0].style.bottom='0px';
        // that.showDiv = false;
        // getCollectDel(id, category).then(function() {
        //   that.storeInfo.userCollect = !that.storeInfo.userCollect;
        // });
      } else {
        getCollectAdd(id, category, mer_id).then(function() {
          that.storeInfo.userCollect = !that.storeInfo.userCollect;
          that.showDiv = true;
          console.log(that.timer);
          if (that.timer != "") {
            clearTimeout(that.timer);
          }
          that.timer = setTimeout(() => {
            that.showDiv = false;
            clearTimeout(that.timer);
          }, 10000);
        });
      }
    },
    // goGoods(item) {
    //   goShopDetail(item).then(() => {
    //     window.scroll(0, 0);
    //     this.$router.push({ path: "/detail/" + item.id });
    //   });
    // },
    //  点击加入购物车按钮
    joinCart: function() {
      //0=加入购物车
      // this.selecAttrTap();
      this.goCat(0);
    },
    telTip() {
      console.log(this.service_tel.length);
      return this.$dialog.toast({ mes: "系统正在维护中" });
    },
    // 加入购物车；
    goCat: function(news) {
      if (!navigator.onLine) {
        return this.$dialog.toast({ mes: "请检测网络情况" });
      }
      let that = this,
        productSelect = that.productValue[this.attrValue];
      //打开属性
      if (that.attrValue) {
        //默认选中了属性，但是没有打开过属性弹窗还是自动打开让用户查看默认选中的属性
        that.attr.cartAttr = !that.isOpen ? true : false;
      } else {
        if (that.isOpen) that.attr.cartAttr = true;
        else that.attr.cartAttr = !that.attr.cartAttr;
      }
      //只有关闭属性弹窗时进行加入购物车
      if (that.attr.cartAttr === true && that.isOpen === false)
        return (that.isOpen = true);
      if (
        !this.attr.productSelect.cart_num ||
        parseInt(this.attr.productSelect.cart_num) <= 0
      )
        return that.$dialog.toast({ mes: "请输入购买数量" });
      //如果有属性,没有选择,提示用户选择
      if (
        that.attr.productAttr.length &&
        productSelect === undefined &&
        that.isOpen === true
      )
        return that.$dialog.toast({ mes: "产品库存不足，请选择其它" });
      let q = {
        productId: that.id,
        cartNum: that.attr.productSelect.cart_num,
        new: news,
        secKillId: that.seckill.id ? that.seckill.id : "0",
        mer_id: that.$route.query.mer_id,
        uniqueId:
          that.attr.productSelect !== undefined
            ? that.attr.productSelect.unique
            : ""
      };
      postCartAdd(q)
        .then(function(res) {
          that.isOpen = false;
          that.attr.cartAttr = false;
          if (news) {
            if (isWeixin()) {
              // window.location.href = base.DsApiUrl()+"/order/submit/" + res.data.cartId+'?mer_id='+that.$route.query.mer_id;
              that.$router.push({
                path:
                  "/order/submit/" +
                  res.data.cartId +
                  "?mer_id=" +
                  that.$route.query.mer_id
              });
            } else {
              that.$router.push({
                path:
                  "/order/submit/" +
                  res.data.cartId +
                  "?mer_id=" +
                  that.$route.query.mer_id
              });
            }
            // that.$router.push({ path: "/order/submit/" + res.data.cartId });
          } else {
            that.$dialog.toast({
              mes: "添加购物车成功",
              callback: () => {
                that.getCartCount(true);
              }
            });
          }
        })
        .catch(res => {
          if (news) {
            cookie.set(
              "uniqueId",
              that.attr.productSelect !== undefined
                ? that.attr.productSelect.unique
                : ""
            );
            cookie.set("secKillId", that.seckill.id ? that.seckill.id : "0");
            cookie.set("loginType", "1");
            cookie.set("cartNum", that.attr.productSelect.cart_num);
          }
          that.isOpen = false;
          return that.$dialog.toast({ mes: res.msg });
        });
    },
    //获取购物车数量
    getCartCount: function(isAnima) {
      let that = this;
      const isLogin = that.isLogin;
      if (isLogin) {
        getCartCount({ numType: 0 }).then(res => {
          that.CartCount = res.data.count;
          //加入购物车后重置属性
          if (isAnima) {
            that.animated = true;
            setTimeout(function() {
              that.animated = false;
            }, 500);
          }
        });
      }
    },
    //立即购买；
    tapBuy: function() {
      //  1=直接购买
      this.goCat(1);
    },
    listenerActionSheet: function() {
      if (isWeixin() === true) {
        this.weixinStatus = true;
      }
      this.posters = true;
    },
    listenerActionClose: function() {
      this.posters = false;
    },
    // 解决ios双击下滑
    double() {
      var agent = navigator.userAgent.toLowerCase(); //检测是否是ios
      var iLastTouch = null; //缓存上一次tap的时间
      if (agent.indexOf("iphone") >= 0 || agent.indexOf("ipad") >= 0) {
        document.body.addEventListener(
          "touchend",
          function(event) {
            var iNow = new Date().getTime();
            iLastTouch =
              iLastTouch || iNow + 1 /** 第一次时将iLastTouch设为当前时间+1 */;
            var delta = iNow - iLastTouch;
            if (delta < 500 && delta > 0) {
              event.preventDefault();
              return false;
            }
            iLastTouch = iNow;
          },
          false
        );
      }
    }
  },
  beforeDestroy: function() {
    document.removeEventListener("scroll", this.onScroll, false);
    window.removeEventListener("scroll", this.handleScroll);
  },
  destroyed: function() {
    var shareUrl = window.location.href;
    if (shareUrl.indexOf("from1=app") != "-1") {
      shareMsg.shareConfig(
        "app",
        "0",
        "0",
        "res.data.storeInfo.store_name",
        "res.data.merchant_name",
        "shareUrl",
        "",
        "",
        "0"
      );
    }
  }
};
</script>
<style scoped>
.mask {
  z-index: 888 !important;
}
.activity_pin {
  width: auto;
  height: 0.44rem;
  background: linear-gradient(
    90deg,
    rgba(233, 51, 35, 1) 0%,
    rgba(250, 101, 20, 1) 100%
  );
  opacity: 1;
  border-radius: 0.22rem;
  padding: 0 0.2rem;
  margin-left: 0.19rem;
}
.activity_miao {
  width: auto;
  height: 0.44rem;
  padding: 0 0.2rem;
  background: linear-gradient(
    90deg,
    rgba(250, 102, 24, 1) 0%,
    rgba(254, 161, 15, 1) 100%
  );
  opacity: 1;
  border-radius: 0.22rem;
  margin-left: 0.19rem;
}
.iconfonts {
  color: #fff !important;
  font-size: 0.28rem;
  display: block;
}
.activity_title {
  font-size: 0.24rem;
  color: #fff;
}
.activity_kan {
  width: auto;
  height: 0.44rem;
  padding: 0 0.2rem;
  background: linear-gradient(
    90deg,
    rgba(254, 159, 15, 1) 0%,
    rgba(254, 178, 15, 1) 100%
  );
  opacity: 1;
  border-radius: 0.22rem;
  margin-left: 0.19rem;
}
.addressBox .phone {
  margin-left: 1.1rem;
}
.corlor-red {
  color: #fc4141;
}
.store-box {
  padding: 0 0.3rem;
  border-bottom: 1px solid #f5f5f5;
}
.geoPage {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  z-index: 10000;
}
.product-con .header {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 0.96rem;
  font-size: 0.3rem;
  color: #050505;
  background-color: #fff;
  z-index: 11;
  border-bottom: 0.01rem solid #eee;
}
.product-con .header .item {
  position: relative;
  margin: 0 0.35rem;
}
.product-con .header .item.on:before {
  position: absolute;
  width: 0.6rem;
  height: 0.05rem;
  background-repeat: no-repeat;
  content: "";
  background: linear-gradient(to left, #ff3366 0%, #ff6533 100%);
  background: -webkit-linear-gradient(to left, #ff3366 0%, #ff6533 100%);
  background: -moz-linear-gradient(to left, #ff3366 0%, #ff6533 100%);
  bottom: -0.1rem;
}
.product-con .store-info {
  margin-top: 0.2rem;
  background-color: #fff;
}
.product-con .store-info .title {
  font-size: 0.28rem;
  color: #282828;
  height: 0.8rem;
  line-height: 0.8rem;
  border-bottom: 0.01rem solid #f5f5f5;
}
.product-con .store-info .info {
  padding: 0 0.3rem;
  height: 1.26rem;
}
.store-info .icon-jiantou {
  color: #7a7a7a;
  font-size: 0.28rem;
}
.product-con .store-info .info .pictrue {
  width: 0.76rem;
  height: 0.76rem;
}
.product-con .store-info .info .pictrue img {
  width: 100%;
  height: 100%;
  border-radius: 0.06rem;
}
.product-con .store-info .info .text {
  width: 56%;
}
.product-con .store-info .info .text .name {
  font-size: 0.3rem;
  color: #282828;
}
.product-con .store-info .info .text .address {
  font-size: 0.24rem;
  color: #666;
  margin-top: 0.03rem;
}
.product-con .store-info .info .text .address .iconfont {
  color: #707070;
  font-size: 0.18rem;
  margin-left: 0.1rem;
}
.address_tit {
  max-width: 88% !important;
}
.addressTxt {
  width: auto;
  font-size: 0.24rem;
}
.product-con .store-info .info .iconfont {
  font-size: 0.4rem;
}
.product-con .superior {
  background-color: #fff;
  margin-top: 0.2rem;
}
.product-con .superior .title {
  height: 0.98rem;
}
.product-con .superior .title img {
  width: 0.3rem;
  height: 0.3rem;
}
.product-con .superior .title .titleTxt {
  margin: 0 0.2rem;
  font-size: 0.3rem;
  background-image: linear-gradient(to right, #f57a37 0%, #f21b07 100%);
  background-image: -webkit-linear-gradient(to right, #f57a37 0%, #f21b07 100%);
  background-image: -moz-linear-gradient(to right, #f57a37 0%, #f21b07 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.product-con .superior .slider-banner {
  width: 6.9rem;
  margin: 0 auto;
  padding-bottom: 0.2rem;
}
.product-con .superior .slider-banner .list {
  width: 100%;
  padding-bottom: 0.2rem;
}
.product-con .superior .slider-banner .list .item {
  width: 2.15rem;
  margin: 0 0.21rem 0.2rem 0;
  font-size: 0.26rem;
}
.product-con .superior .slider-banner .list .item:nth-of-type(3n) {
  margin-right: 0;
}
.product-con .superior .slider-banner .list .item .pictrue {
  width: 100%;
  height: 2.15rem;
  position: relative;
}
.product-con .superior .slider-banner .list .item .pictrue img {
  width: 100%;
  height: 100%;
  border-radius: 0.06rem;
}
.product-con .superior .slider-banner .list .item .name {
  color: #282828;
  margin-top: 0.12rem;
}
.product-con .superior .slider-banner .swiper-pagination-bullet {
  background-color: #999;
}
.product-con .superior .slider-banner .swiper-pagination-bullet-active {
  background-color: #e93323;
}
.product-con .product-bg .pages {
  position: absolute;
  background-color: rgba(139, 135, 153, 0.36);
  height: 0.4rem;
  width: 1.1rem;
  right: 0rem;
  bottom: 0.3rem;
  box-sizing: border-box;
  line-height: 0.4rem;
  padding-left: 0.22rem;
  font-size: 0.24rem;
  border-radius: 0.2rem 0 0 0.2rem;
  color: rgba(255, 255, 255, 1);
  z-index: 9;
}
.mask {
  -webkit-filter: blur(2px);
  -moz-filter: blur(2px);
  -ms-filter: blur(2px);
  filter: blur(2px);
  z-index: 888 !important;
}
.footer .icon-shoucang1 {
  color: #e93323;
}
.product-con .product-intro .conter{
  word-break: break-all;
  padding: 0 0.3rem;
}
.product-con .product-intro .conter div {
  width: 100% !important;
}
.generate-posters {
  width: 100%;
  height: 1.7rem;
  background-color: #fff;
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 999;
  transform: translate3d(0, 100%, 0);
  -webkit-transform: translate3d(0, 100%, 0);
  -ms-transform: translate3d(0, 100%, 0);
  -moz-transform: translate3d(0, 100%, 0);
  -o-transform: translate3d(0, 100%, 0);
  transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  -webkit-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  -moz-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  -o-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  opacity: 0;
}
.generate-posters.on {
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  -ms-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0);
  opacity: 1;
}
.on1 {
  /* transform: translate3d(0, 0, 0) !important; */
  /* opacity: 1 !important; */
  /* transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  -ms-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0);
  opacity: 1; */
  bottom: 0 !important;
  opacity: 1 !important;
}
.generate-posters .item {
  flex: 50%;
  -webkit-flex: 50%;
  -ms-flex: 50%;
  text-align: center;
}
.generate-posters .item .iconfont {
  font-size: 0.8rem;
  color: #5eae72;
}
.generate-posters .item .iconfont.icon-haibao {
  color: #5391f1;
}
.noscroll {
  height: 100%;
  overflow: hidden;
}
</style>
<style scoped lang="scss">
.name {
  color: rgba(0, 0, 0, 0.7);
  font-weight: 400;
  font-size: 0.28rem;
}
.confirmBox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 778;
  height: 100vh;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  .ceng {
    display: block;
    width: 6rem;
    height: 2.9rem;
    background: rgba(255, 255, 255, 1);
    border-radius: 0.16rem;
    justify-content: center;
    margin: 50% auto 0;
    justify-items: center;
    .confirmTltle {
      width: 100%;
      height: 1.84rem;
      line-height: 1.84rem;
      text-align: center;
      font-size: 0.34rem;
      color: #333;
      border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    }
    .NoConfirm {
      display: inline-block;
      width: 50%;
      height: 1.04rem;
      line-height: 1.04rem;
      text-align: center;
      font-size: 0.32rem;
      color: rgba(0, 0, 0, 0.5);
      border-right: 1px solid rgba(0, 0, 0, 0.2);
    }
    .confirm {
      display: inline-block;
      width: 50%;
      height: 1.04rem;
      line-height: 1.04rem;
      text-align: center;
      font-size: 0.32rem;
      color: rgba(68, 115, 225, 1);
    }
  }
}
#title0 {
  .active_label {
    width: 100%;
    height: 1.16rem;
    background: url("../../assets/images/active_bg1.png") no-repeat;
    background-size: 100% 100%;
    .free_buy {
      width: 100%;
      height: 100%;
      // display: flex;
      // align-items: center;
      overflow: hidden;
      .left {
        float: left;
        margin-left: 0.3rem;
        font-size: 0.36rem;
        font-family: PingFangSC-Semibold, PingFang SC;
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
        // line-height:25px;
        // letter-spacing:1px;
      }
      .right {
        float: left;
        margin-left: 3.28rem;
        display: flex;
        flex-direction: column;
        // margin-right: 0.66rem;
        font-size: 0.24rem;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: rgba(224, 33, 107, 1);
        .stock {
          font-size: 0.24rem;
          margin: 0.1rem 0 0.06rem 0;
        }
        .num {
          font {
            display: inline-block;
            text-align: center;
            width: 0.4rem;
            height: 0.52rem;
            line-height: 0.52rem;
            background: rgba(224, 33, 107, 1);
            border-radius: 0.04rem;
            font-size: 0.42rem;
            font-weight: 600;
            margin-right: 0.04rem;
            color: #fff;
          }
        }
      }
    }
  }
  .active_label1 {
    width: 100%;
    height: 1.16rem;
    background: url("../../assets/images/seckillbg.png") no-repeat;
    background-size: 100% 100%;
    .free_buy {
      width: 100%;
      height: 100%;
      // display: flex;
      // align-items: center;
      overflow: hidden;
      .left {
        float: left;
        margin-left: 1.28rem;
        font-size: 0.56rem;
        font-weight: 600;
        line-height: 1;
        padding-top: 0.3rem;
        color: rgba(255, 255, 255, 1);
        // line-height:25px;
        // letter-spacing:1px;
      }
      .right {
        float: right;
        width: auto;
        height: 100%;
        .likeTitle {
          font-size: 0.24rem;
          font-weight: 400;
          color: rgba(229, 57, 81, 1);
          line-height: 0.34rem;
          padding: 0.1rem 1rem 0.06rem 0;
        }
        .time {
          font-size: 0.28rem;
          font-weight: 300;
          color: rgba(212, 62, 86, 1);
          line-height: 0.34rem;
          span {
            min-width: 0.3rem;
            min-height: 0.34rem;
            display: inline-block;
            font-weight: 300;
            color: rgba(255, 255, 255, 1);
            background: rgba(229, 57, 81, 1);
            padding: 0.08rem 0.04rem;
            border-radius: 0.04rem;
          }
        }
      }
    }
  }
}
.first_order {
  width: 100%;
  height: 1.6rem;
  font-size: 0.4rem;
  font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  font-weight: bold;
  color: rgba(255, 255, 255, 1);
  padding: 0.24rem 0 0 0.3rem;
  box-sizing: border-box;
  background: #fff;
  .item {
    width: 6.9rem;
    height: 1.12rem;

    background: url("../../assets/images/active_bg2.png") no-repeat;
    background-size: 100% 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    .item_left {
      float: left;
      margin-left: 0.34rem;

      & p:first-child {
        // margin-bottom: 0.12rem;
        // margin-top: .2rem;
        display: flex;
        align-items: center;
        font-size: 0.4rem;
        img {
          width: 0.32rem;
          height: 0.32rem;
          margin-top: 0.06rem;
          margin-left: 0.16rem;
        }
      }
      & p:last-child {
        font-size: 0.24rem;
        font-weight: 400;
      }
    }
    .item_right {
      // float: right;
      border-left: 1px solid rgba(255, 255, 255, 0.2);
      margin-left: auto;
      font-size: 0.28rem;
      padding: 0.08rem 0;
      padding-left: 0.34rem;
      // margin-top: 0.34rem;
      margin-right: 0.4rem;
    }
  }
}
.mask1 {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  // bottom:0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  // transition: all 1s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  // transform: translate3d(0, 100%, 0);
  //   transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  //   opacity: 0;
  .content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    // height:5.9rem;
    background: #fff;
    border-radius: 0.4rem 0.4rem 0px 0px;
    font-size: 0.28rem;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    box-sizing: border-box;
    // transform: translateY(0%);
    // transition: all .3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
    // opacity: 0;
    .top {
      width: 100%;
      height: 0.96rem;
      text-align: center;
      border-bottom: 1px solid rgba(0, 0, 0, 0.1);
      line-height: 0.96rem;
    }
    .center {
      font-weight: 400;
      color: rgba(0, 0, 0, 0.8);
      line-height: 0.44rem;
      padding: 0.56rem 0.28rem 0.78rem 0.32rem;
      p:nth-child(2) {
        margin: 0.16rem 0;
      }
    }
    .bottom {
      // padding:0.26rem 0 0.36rem 0;
      border-top: 1px solid rgba(0, 0, 0, 0.1);
      color: rgba(68, 115, 225, 1);
      text-align: center;
      height: 1.06rem;
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.32rem;
      font-weight: 500;
    }
  }
}
// .first_order-enter-active,.first_order-leave-active{
//   transition: all 1s cubic-bezier(0.25, 0.5, 0.5, 0.9);
// }
.first_order-enter {
  transform: translateY(0%);
}
.first_order-leave {
  transform: translateY(100%);
}
</style>
